<template>
  <div class="nav_wrap" :style="{ height: navH + 'px', paddingTop: statusBarH + 'px' }">
    <div class="nva_bar_wrap" :style="{ height: customNavBarH + 'px' }">
      <!-- 返回按钮 -->
      <image v-if="isShowPre" @click="goBack" class="back_icon" src="http://121.41.75.32:8002/file/static/back.png" mode="heightFix" :style="{ height: customNavBarH - 22 + 'px' }" />
      <!-- 主页按钮 -->
<!--      <image v-if="isShowHome" @click="goHome" class="home_icon" src="http://121.41.75.32:8002/file/static/homeicon.png" mode="heightFix" :style="{ height: customNavBarH - 22 + 'px' }" />-->
      <!-- 搜索输入框 -->

      <!-- 文本类型标题 -->
      <div v-if="isShowTxtTitle" class="arrow_title_wrap">
        <text>{{ navTitle }}</text>
      </div>
      <!-- 下拉类型标题 -->
      <div v-else  @click="selectName" class="arrow_title_wrap">
        <text>{{ navTitle }}</text>
        <image class="downarrow_icon" src="http://121.41.75.32:8002/file/static/downarrow.png" mode="heightFix" :style="{ height: customNavBarH - 15 + 'px' }" />
      </div>
    </div>
  </div>
</template>

<script>
import navmixin from '@/mxins/nav.js'
export default {
  props: {
    //是否显示返回按钮
    isShowPre: {
      type: Boolean,
      default: false,
    },
    // 是否显示主页
    isShowHome: {
      type: Boolean,
      default: false,
    },
    //是否需要点击按钮
    isClick:{
      type: Number
    },
    // 是否显示文本类标题
    isShowTxtTitle: {
      type: Boolean,
      default: true,
    },
    //标题
    navTitle: {
      type: String,
      default: '标题',
    },
  },
  mixins: [navmixin],
  computed: {},
  data() {
    return {}
  },
  mounted() {
    // 初始化--mixin
    this.Fun_init()
  },
  methods: {
    // 返回上一页按钮
    goBack() {
      uni.navigateBack({
        delta: 1,
      })
    },
    // 返回首页
    goHome() {
      uni.navigateTo({
        url: '/pages/home/index',
      })
    },
    // 选择售点名称
    selectName() {
      uni.navigateTo({
        url: '/pages/saleplace/index',
      })
      // if (this.isClick === 0){
      //   uni.navigateTo({
      //     url: '/pages/saleplace/index',
      //   })
      // }else {
      //   this.$emit('ifClick','绑定的客户的用户不允许切换')
      // }
    },
  },
}
</script>

<style lang="scss" scoped>
.nav_wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  background-color: #ffffff;
  .nva_bar_wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    // 返回图标
    .back_icon {
      position: absolute;
      left: 5px;
    }
    .home_icon {
      position: absolute;
      left: 25px;
    }
    // 主页图标
    // 下拉类型标题
    .arrow_title_wrap {
      display: flex;
      font-size: 34rpx;
      align-items: center;
    }
    // padding-left: 20rpx;
  }
}
</style>
